#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
const int N = 1005;

int n, m;
int a[N], b[N];

void match() {
  int vis[N] = {0};
  int x = 0, y = 0;
  rep(i, 1, n) {
    if (b[i] == a[i]) {
      x++;
      vis[i] = 1;
    }
  }
  rep(i, 1, n) {
    if (b[i] == a[i]) continue;
    rep(j, 1, n) {
      if (vis[j]) continue;
      if (b[i] == a[j]) {
        y++;
        vis[j] = 1;
        break;
      }
    }
  }
  cout << "    " << '(' << x << ',' << y << ')' << '\n';
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int id = 0;
  while ((cin >> n) && n) {
    ++id;
    cout << "Game " << id << ":\n";
    rep(i, 1, n) cin >> a[i];
    while (true) {
      rep(i, 1, n) cin >> b[i];
      if (!b[1]) break;
      match();
    }
  }
  return 0;
}
